package org.study.tk.boot.config;

import jakarta.annotation.Resource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * 注册Bean
 *
 * @author Administrator
 */
@Configuration
public class RegistryBean {
    @Resource
    private SnowflakeIdConfig idConfig;

    @Bean
    public ApplicationContextUtil springContextUtil() {
        return new ApplicationContextUtil();
    }

    @Bean
    public SnowflakeIdWorker snowflakeIdWorker() {
        return new SnowflakeIdWorker(idConfig.getWorkerId(), idConfig.getDataCenterId(), idConfig.getStandbyDataCenterId());
    }
}